package com.wiyun.engine.skeleton;

import java.io.IOException;

import android.content.res.AssetManager;
import android.view.MotionEvent;

import com.wiyun.engine.actions.Action;
import com.wiyun.engine.actions.CallFunc;
import com.wiyun.engine.actions.DelayTime;
import com.wiyun.engine.actions.FiniteTimeAction;
import com.wiyun.engine.actions.IntervalAction;
import com.wiyun.engine.actions.RepeatForever;
import com.wiyun.engine.actions.Sequence;
import com.wiyun.engine.nodes.ColorLayer;
import com.wiyun.engine.nodes.Director;
import com.wiyun.engine.nodes.MultiplexLayer;
import com.wiyun.engine.types.WYColor4B;
import com.wiyun.engine.types.WYPoint;

public class TopLayer extends MultiplexLayer {
	 public TopLayer(AssetManager assetManager) throws IOException {
     	addLayer(new MainLayer(assetManager));
     	addLayer(new PKLayer(assetManager));
     	
     	/*IntervalAction a = Sequence.make((FiniteTimeAction)DelayTime.make(2f).autoRelease(), 
     			(FiniteTimeAction)CallFunc.make(this, "changeLayer").autoRelease());
     	Action repeat = (Action)RepeatForever.make(a).autoRelease();
     	runAction(repeat);*/
        setTouchEnabled(true);
     }

     public void changeLayer() {
     	switchTo(getCurrentLayerIndex() + 1);
     }
	 @Override
     public boolean wyTouchesBegan(MotionEvent event) {
		
		 changeLayer();
	     	return true;
     }
}
